﻿Imports MySql.Data.MySqlClient
Imports IAPM_DENDANE.MySQLConnect

Public Class proceduresStock
    Public Shared Function procRechNomPdt(ByVal nomChamp As String, ByRef nomDataGrid As DataGridView)
        Try
            Dim MyCommand As MySqlCommand = maconnexion.CreateCommand

            'Commande pointe sur la procédure stockée
            MyCommand.CommandText = "rechNomPdt"
            MyCommand.CommandType = CommandType.StoredProcedure

            'Initialisation de la procédure stockée
            Dim param As MySqlParameter = MyCommand.Parameters.Add("nomPdt", MySqlDbType.VarChar)
            param.Value = nomChamp

            'Initialisation du dataGridView
            nomDataGrid.Rows.Clear()

            maconnexion.Open()

            Dim MyReader As MySqlDataReader = MyCommand.ExecuteReader()

            Do While MyReader.Read
                'Remplissage des lignes du dataGrid
                nomDataGrid.Rows.Add(MyReader(1), MyReader(2), MyReader(3), MyReader(4))
            Loop

            MyReader.Close()
            maconnexion.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Function

End Class
